package com.job.meeting.pojo;

import javax.persistence.Table;

import com.google.gson.Gson;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data//注解在类上；提供类所有属性的 getting 和 setting 方法，此外还提供了equals、canEqual、hashCode、toString 方法
@AllArgsConstructor//有参构造器
@NoArgsConstructor//无参构造器
@Table(name = "meeting_room")//声明此对象映射到数据库的数据表，通过它可以为实体指定表(talbe)
public class meetingRoom implements Comparable<meetingRoom>{
    private int ID;
    private String name;
    private String location;
    private int capacity;
    private String main_use;
    private int status;

    //构造函数，输入json字段获得对应的对象
    public meetingRoom(String json){
        meetingRoom m = new Gson().fromJson(json, meetingRoom.class);
        this.setID(m.getID());
        this.setName(m.getName());
        this.setLocation(m.getLocation());
        this.setCapacity(m.getCapacity());
        this.setMain_use(m.main_use);
        this.setStatus(m.getStatus());
    }

    //覆写toString函数，返回一个对象对应的json字段
    public String toString(){
        return new Gson().toJson(this);
    }

    @Override
    public int compareTo(meetingRoom o) {
        return this.name.compareTo(o.getName());
    }



   /* public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }

    public String getMain_use() {
        return main_use;
    }

    public void setMain_use(String main_use) {
        this.main_use = main_use;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

     */
}
